import { Inject } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { StudentInviteLogEntity } from '../../entity/inviteLog';
import { StudentInviteLogService } from '../../service/inviteLog';
import { BaseSysUserEntity } from '../../../base/entity/sys/user';
import { UserInfoEntity } from '../../../user/entity/info';

/**
 * 邀请日志信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: StudentInviteLogEntity,
  service: StudentInviteLogService,
  pageQueryOp: {
    keyWordLikeFields: [],
    fieldEq: ['a.salesId', 'a.studentId', 'a.status', 'a.type', 'a.behave'],
    join: [
      {
        entity: BaseSysUserEntity,
        alias: 'b',
        condition: 'a.salesId = b.id',
        type: 'leftJoin',
      },
      {
        entity: UserInfoEntity,
        alias: 'c',
        condition: 'a.studentId = c.id',
        type: 'leftJoin',
      },
    ],
    select: ['a.*', 'b.name as salesName', 'c.nickName as studentName'],
  },
})
export class AdminStudentInviteLogController extends BaseController {
  @Inject()
  studentInviteLogService: StudentInviteLogService;
}
